package cn.com.twoke.easyproject.config.event;

import org.springframework.aot.hint.annotation.Reflective;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.AliasFor;
import org.springframework.scheduling.annotation.Async;

import java.lang.annotation.*;

import static cn.com.twoke.easyproject.config.event.EventThreadPoolConfiguration.EVENT_EXECUTOR;

@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Async
@EventListener
public @interface AsyncEventListener {

    @AliasFor(value = "classes", annotation = EventListener.class)
    Class<?>[] value() default {};

    @AliasFor(value = "value", annotation =  EventListener.class)
    Class<?>[] classes() default {};

    @AliasFor(value = "condition", annotation =  EventListener.class)
    String condition() default "";

    @AliasFor(value = "id", annotation =  EventListener.class)
    String id() default "";

    @AliasFor(value = "value", annotation =  Async.class)
    String asyncExecutor() default EVENT_EXECUTOR;

}
